package com.atguigu.ggkt.order.controller;


import com.atguigu.ggkt.model.order.OrderInfo;
import com.atguigu.ggkt.order.service.OrderInfoService;
import com.atguigu.ggkt.result.Result;
import com.atguigu.ggkt.vo.order.OrderInfoQueryVo;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Map;

/**
 * <p>
 * 订单表 订单表 前端控制器
 * </p>
 *
 * @author Jetwang
 * @since 2022-07-02
 */
@RestController
@RequestMapping("/admin/order/order_info")
@Api("订单信息管理接口")
public class OrderInfoController {
    @Autowired
    private OrderInfoService orderInfoService;

    /**
     * 分页查询订单列表
     * @param current 当前页
     * @param limit 每页大小
     * @param orderInfoQueryVo json格式订单条件查询对象
     * @return
     */
    @ApiOperation("分页查询订单列表")
    @PostMapping("/{current}/{limit}")
    public Result list(@PathVariable Long current,
                       @PathVariable Long limit,
                       @RequestBody OrderInfoQueryVo orderInfoQueryVo) {
        // 创建page分页对象
        Page<OrderInfo> page = new Page<>(current, limit);
        Map<String, Object> map = orderInfoService.selectOrderInfoPage(page, orderInfoQueryVo);
        return Result.ok(map);
    }

}

